package edu.ubb.scrumster.model.model;

import java.util.List;

public class Scrum implements AbstractModel {
	int id;
	String name;
	Project project;
	List<User> members;
	List<Sprint> sprints;
	List<Comment> comments;

	public List<Comment> getComments() {
		return comments;
	}

	public void setComments(List<Comment> comments) {
		this.comments = comments;
	}

	public Scrum(String name, Project project) {
		super();
		this.name = name;
		this.project = project;
	}

	public Scrum(int id, String name, Project project) {
		super();
		this.id = id;
		this.name = name;
		this.project = project;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Project getProject() {
		return project;
	}

	public void setProject(Project project) {
		this.project = project;
	}

	public List<User> getMembers() {
		return members;
	}

	public void setMembers(List<User> members) {
		this.members = members;
	}

	public List<Sprint> getSprints() {
		return sprints;
	}

	public void setSprints(List<Sprint> sprints) {
		this.sprints = sprints;
	}

	public String getObjectType() {
		return "Scrum";
	}

	public void validate() throws ModelException{
		if (this.project==null){
			throw new ModelException("There is no project");
		}
		if (this.name.equals("") || this.name.isEmpty()){
			throw new ModelException("The name is empty");
		}
	}
}
